package examlab.gc;

public class Gabc {

    static int i = 0;
    Gabc g = null;

    @Override
    public void finalize() {
        //        System.out.println("Foi!!");
        i++;
    }

    public static void main(String arhs[]) {
        Gabc gab1 = new Gabc();
        Gabc gab2 = new Gabc();
        Gabc gab3 = new Gabc();
        gab3.g = gab1;
        gab1.g = gab2;
        gab3.g = gab2;
        gab1 = null;
        gab3 = null;

        //        try {
        //            Thread.sleep(1000);
        //        } catch (InterruptedException e) {
        //            // TODO Auto-generated catch block
        //            e.printStackTrace();
        //        }
        System.out.print(i + " objects removed");
    }

}
